import { Map } from 'immutable';
import * as types from './constans';
const initState = Map({
    isExpandSlider: false,
    playList: [],
    likeSongs: [],
    playHistorys: [],
    curSong: {},
    lyric: [],
    isFullScreen: false,
    playing: false,
    sequence: 0,
    percent: 0,
    curTime: 0,
    songReady: false,
    curLyrIdx: 0,
    curShow: 'cd',
})

const reducer = (state = initState, actions) => {
    const { type, payload } = actions;
    switch (type) {
        case types.CHANGE_IS_EXPAND_SLIDER:
            return state.set('isExpandSlider', payload);
        case types.CHANGE_CUR_SONG:
            return state.set('curSong', payload)
        case types.CHANGE_PLAY_LIST:
            return state.set('playList', payload);
        case types.CHANGE_PLAY_ING:
            return state.set('playing', payload)
        default:
            return state
    }
}

export default reducer